#pragma once

#include <gofcl_dac_r.h>

typedef struct {
	u32_s DEN0 : 1;
	u32_s DBOFF0 : 1;
	u32_s DTEN0 : 1;
	u32_s DTSEL0 : 3;
	u32_s DWM0 : 2;
	u32_s DWBW0 : 4;
	u32_s DDMAEN0 : 1;
	u32_s : 3;
	u32_s DEN1 : 1;
	u32_s DBOFF1 : 1;
	u32_s DTEN1 : 1;
	u32_s DTSEL1 : 3;
	u32_s DWM1 : 2;
	u32_s DWBW1 : 4;
	u32_s DDMAEN1 : 1;
	u32_s : 3;
} dac_ctl_s;

_Static_assert(sizeof(dac_ctl_s) == 4, "Struct dac_ctl_s defined error!");

static inline void dac_wreg_ctl_s(dac_ctl_s ctl) {
	union {
		dac_ctl_s c;
		u32_s u;
	} cu = {
		.c = ctl,
	};
	dac_wreg(DAC_CTL_R, cu.u);
}
